;--------------------------------------
;
; strcat.asm
;
; append source to destination string
;
;

;--------------------------------------
;
; include defs, prototypes and macros
;

include tab6.inc

;--------------------------------------
;
; begin code segment
;

	.CODE

;--------------------------------------
;
; begining of procedure
;

strcat	PROC PASCAL PUBLIC USES ds es si di,dest:PBYTE,srce:PBYTE

; initialize pointers

 IF mdl eq 3

; set dest es:[di]

        les     di,dest

; set srce ds:[si]

        lds     si,srce

  ELSE

        push    ds
        pop     es

; set dest es:[di]

        mov     di,dest

; set srce ds:[si]

        mov     si,srce

  ENDIF

; find the end of the destination string

        .WHILE 1
        mov     al,es:[di]
        .IF (al == 0)
             .BREAK
        .ELSE
        inc     di
        .ENDIF
        .ENDW

; copy strings until source is fully copied to 
; destination

	.WHILE 1
	mov	al,BYTE PTR ds:[si]
	mov	BYTE PTR es:[di],al
	inc	di
	inc	si
	.BREAK .IF (al==0)
	.ENDW
	ret	                       ; return to caller
strcat	ENDP

;
; end of strcat procedure
;
;--------------------------------------

	END

;
; end of strcat.asm
;
;--------------------------------------


